/**
 * Note: 路由配置项
 *
 * path: '/path'                    // 路由路径
 * name:'router-name'               // 设定路由的名字，一定要填写不然使用<keep-alive>时会出现各种问题
 * meta : {
    title: 'title'                  // 设置该路由在侧边栏的名字
    icon: 'icon-name'                // 设置该路由的图标
    activeMenu: '/system/user'      // 当路由设置了该属性，则会高亮相对应的侧边栏。
    query: '{"id": 1}'             // 访问路由的默认传递参数
    hidden: true                   // 当设置 true 的时候该路由不会在侧边栏出现 
    hideTab: true                   //当设置 true 的时候该路由不会在多标签tab栏出现
  }
 */

import { PageEnum } from '@/enums/pageEnum';
import Layout from '@/layout/default/index.vue';
import type { RouteRecordRaw } from 'vue-router';

export const LAYOUT = () => Promise.resolve(Layout);

export const INDEX_ROUTE_NAME = Symbol();

export const constantRoutes: Array<RouteRecordRaw> = [
  //   {
  //     path: "/:pathMatch(.*)*",
  //     component: () => import("@/views/error/404.vue"),
  //     hidden: true,
  //   },
  //   {
  //     path: PageEnum.ERROR_403,
  //     component: () => import("@/views/error/403.vue"),
  //     hidden: true,
  //   },

  {
    path: PageEnum.LOGIN,
    component: () => import('@/views/account/login.vue'),
    hidden: true,
  },
  {
    path: '/',
    component: LAYOUT,
    redirect: '/user',
    hidden: true,
  },
  {
    path: '/user',
    component: LAYOUT,
    redirect: '/user/teacher',
    children: [
      {
        path: 'teacher',
        component: () => import('@/views/user/teacher/index.vue'),
        meta: {
          title: '教师管理',
          hidden: false,
          query: '',
        },
      },
      {
        path: 'teacher/detail',
        component: () => import('@/views/user/teacher/detail/index.vue'),
        meta: {
          title: '教师详情',
          hidden: true,
        },
      },
      {
        path: 'student',
        component: () => import('@/views/user/student/List/index.vue'),
        meta: {
          title: '学生管理',
          query: '',
        },
      },
      {
        path: 'student/detail',
        component: () => import('@/views/user/student/detail/index.vue'),
        // name: Symbol(),
        meta: {
          title: '学生详情',
          hidden: true,
        },
      },
      {
        path: 'excellenceWorks',
        component: () => import('@/views/excellenceWorks/List/index.vue'),
        name: Symbol(),
        meta: {
          title: '优秀作品',
          query: '',
        },
      },
      {
        path: 'department',
        component: () => import('@/views/department/List/index.vue'),
        name: Symbol(),
        meta: {
          title: '院系管理',
          query: '',
        },
      },
      {
        path: 'class',
        component: () => import('@/views/classes/List/index.vue'),
        name: Symbol(),
        meta: {
          title: '班级管理',
          query: '',
        },
      },
      //   {
      //     path: "teacher/detail",
      //     component: () => import("@/views/user/teacher/detail/index.vue"),
      //     name: Symbol(),
      //     meta: {
      //       title: "教师详情",
      //     },
      //     hidden: true,
      //   },
    ],
    meta: {
      title: '系统首页',
      icon: 'el-icon-Document',
    },
  },
];

export const INDEX_ROUTE: RouteRecordRaw = {
  path: PageEnum.INDEX,
  component: LAYOUT,
  name: INDEX_ROUTE_NAME,
};
